using SimpleOrmCFPC.Apis.Db;
using SimpleOrmCFPC.Core.Dao;
using SimpleOrmCFPC.Core.Dao.Helpers;
using SimpleOrmCFPC.Core.Query.Requests;

namespace SimpleOrmCFPC.Core.Orm
{
    public class LinqDaoFactory : RealOrm.IDaoFactory
    {
        private IDb db;
        private CreateEntityRequestFactory requesterFactory;
        private RequestExecutor requestExecutor;

        public LinqDaoFactory(IDb db, CreateEntityRequestFactory requesterFactory, RequestExecutor requestExecutor)
        {
            this.db = db;
            this.requesterFactory = requesterFactory;
            this.requestExecutor = requestExecutor;
        }


        public IDao<T> Create<T>() where T : new()
        {
            return new LinqDao<T>(db, requesterFactory, requestExecutor);
        }
    }
}